package main

import (
	"OrderSrv/common/global"
	_ "OrderSrv/common/initter"
	"OrderSrv/handle"
	"OrderSrv/proto"
	"fmt"
	"go.uber.org/zap"
	"google.golang.org/grpc"
	"net"
)

func main() {
	//实例化grpc
	server := grpc.NewServer()
	proto.RegisterUserServer(server, &handle.OrderServer{})
	lis, err := net.Listen("tcp", fmt.Sprintf("%s:%d", "127.0.0.1", global.Port))
	if err != nil {
		panic("failed to listen:" + err.Error())
	}
	zap.S().Info("Serve启动成功,地址为:::", fmt.Sprintf("%s:%d", "127.0.0.1", global.Port))
	err = server.Serve(lis)
	if err != nil {
		panic("failed to start grpc:" + err.Error())
	}
}
